<template>
  <div ref="widget" class="fund-manager" :style="{ backgroundColor: style.backgroundColor }">
    <div class="d-flex jc-between" style="padding: 32px 0 32px 32px">
      <div class="t-center">
        <template>
          <div v-for="(item, i) in config.userTagList" :key="i">
            <div class="list-item t-ellipsis" :style="{ backgroundColor: style.backgroundColor }">
              {{ item }}
            </div>
          </div>
        </template>
      </div>
      <div>
        <div class="avatar-box">
          <img class="fulled-h fulled-w" :src="$staticRes(config.userImg)" />
        </div>
        <div class="avatar-info d-flex al-center">
          <span style="font-size: 28px; color: #b2b5be">部门名称</span>
          <span class="fw-bold" style="margin-left: 32px; font-size: 32px">{{ config.userName }}</span>
        </div>
      </div>
    </div>
    <div class="manager-panel">
      <div class="d-flex jc-between t-center" style="padding-bottom: 32px">
        <div>
          <div class="keyword">{{ config.managerScale }}</div>
          <div class="fw-bold" style="margin-top: 16px; font-size: 24px; color: #b87a1e">招新人数</div>
        </div>
        <div>
          <div class="keyword">{{ config.workTime }}</div>
          <div class="fw-bold" style="margin-top: 16px; font-size: 24px; color: #b87a1e">部门历史</div>
        </div>
        <div>
          <div class="keyword">{{ config.investIdea }}</div>
          <div class="fw-bold" style="margin-top: 16px; font-size: 24px; color: #b87a1e">投资理念</div>
        </div>
        <div>
          <div class="keyword">{{ config.focusVip }}</div>
          <div class="fw-bold" style="margin-top: 16px; font-size: 24px; color: #b87a1e">重点关注</div>
        </div>
      </div>
      <div class="person-desc d-flex al-center">
        {{ config.userDesc }}
      </div>
    </div>
  </div>
</template>

<script>
  import widgetResizeMixin from '@/mixins/widgetResizeMixin';

  export default {
    mixins: [widgetResizeMixin],

    props: {
      widget: {
        type: Object,
        default: () => ({})
      }
    },

    computed: {
      config() {
        return this.widget.config;
      },
      style() {
        return this.widget.style;
      }
    },

    watch: {
      'config.userDesc': 'resize'
    }
  };
</script>

<style lang="scss" scoped>
  .fund-manager {
    border-radius: 10px;
    padding-bottom: 32px;
    font-size: 28px;
    background: #d6a94e;

    .list-item {
      border: 2px solid #d6a94e;
      border-radius: 34px;
      padding: 0 10px;
      width: 324px;
      height: 72px;
      line-height: 68px;
      letter-spacing: 2px;

      &:not(:last-of-type) {
        margin-bottom: 28px;
      }
    }

    .avatar-box {
      position: relative;
      z-index: 0;
      padding-top: 8px;
      width: 300px;
      height: 308px;

      &::before {
        position: absolute;
        top: 0;
        left: 50%;
        z-index: -1;
        border-radius: 50%;
        width: 272px;
        height: 272px;
        background-color: #fff;
        transform: translateX(-50%);
        content: '';
      }
    }

    .avatar-info {
      border-radius: 32px 0 0 32px;
      padding-left: 24px;
      width: 312px;
      height: 64px;
      background: linear-gradient(180deg, #585a62, #1d1f23);
    }

    .manager-panel {
      margin: 0 32px;
      border-radius: 10px;
      padding: 32px 16px;
      background: linear-gradient(180deg, #ffe9c9, #ffd495);

      .keyword {
        height: 28px;
        font-size: 28px;
        font-weight: bold;
        line-height: 28px;
        color: #6b4000;
      }

      .person-desc {
        border-top: 2px solid #ffc269;
        padding-top: 32px;
        min-height: 120px;
        line-height: 1.2;
        text-align: justify;
        white-space: break-spaces;
        word-break: break-all;
        color: #6b4000;
      }
    }
  }
</style>
